/**
 * Created by dale on 2017/10/19.
 */
/**
 * Created by dale on 2017/10/19.
 */
var noAfList;
var startDom;
var endDom;
$(document).ready(function () {
    noAfList = $('#noAfList');
    $('.xh-datagrid-toolbar').parseToolbar();

    startDom    = $('#List_Search_StartTime');
    endDom      = $('#List_Search_EndTime');
    startDom.datebox();
    endDom.datebox();

    // startDom.datebox('setValue', GetDateStr(-7));
    // endDom.datebox('setValue', GetDateStr(0));

    noAfList.initDataGrid(baseUrl + 'frontend/msg/getNoAfList',{queryParams:getParams()}).setSelectThenEnable(['bt_list_del']);


    xhTool.bindDocKeyDown($('#bt_list_search'));
    $('#bt_list_search').click(function () {
        noAfList.addDataGridParams(getParams());
    });



    DataGrid.onDblClickRow=function (rowIndex, rowData) {
        var iNoId = rowData['iNoId'];
        var str=rowData['iNoType'];

        window.top.xhTop.showModal({
            title:'查看'+str,
            content: '<iframe src="'+baseUrl+'frontend/msg/noticeDetail?iNoId='+iNoId+'"  style="width: 100%;;border-style: none;padding: 0px;height:520px"  scrolling="yes"   ></iframe>',
        });
        return false;
    }
});
function GetDateStr(AddDayCount) {
    var dd = new Date();
    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
    var y = dd.getFullYear();
    var m = dd.getMonth()+1;//获取当前月份的日期
    var d = dd.getDate();
    return y+"-"+m+"-"+d;
}

function getParams() {
    var key = xhExtra.getValue($('#list_search'));
    var startTime   = startDom.getElementValue(),
        endTime     = endDom.getElementValue();
    var type        =xhExtra.getValue($('#select_type'))
    var params={key:key,startTime:startTime,endTime:endTime,type:type};
    return params;
}